import java.util.Arrays;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int len = in.nextInt();
            int count = in.nextInt();
            int[] acid = new int[len];
            int[] sweet = new int[len];
            int[][] arr = new int[len][2];
            for (int i = 0; i < len; i++) {
                acid[i] = in.nextInt();
                arr[i][0] = acid[i];
            }
            for (int i = 0; i < len; i++) {
                sweet[i] = in.nextInt();
                arr[i][1] = sweet[i];
            }
            Arrays.sort(arr, (a,b) -> {
                return a[1] == b[1] ? a[0]-b[0] : b[1]-a[1];
            });
            long sumAcid = 0;
            long sumSweet = 0;
            for (int i = 0; i < count; i++) {
                sumAcid += arr[i][0];
                sumSweet += arr[i][1];
            }
            System.out.println(sumAcid + " " + sumSweet);
        }
    }
}
